import java.io.InputStream;
import java.util.Properties;

public class ThirdFactory {
    public Person doPerson() {
        //创建properties对象，来解析properties文件
        Properties properties = new Properties();
        //二阶段输入流通过上面来读取？
        InputStream resourceAsStream = ThirdFactory.class.getResourceAsStream("java-83-git-demo/src/doPerson.properties");
        String personName;
        Person person = null;
        try {
            //需要加载读取我们的配置文件
            properties.load(resourceAsStream);
            personName = properties.getProperty("person");
            //通过从配置文件中拿到的全限定类类名 来创建对象
            person = (Person) Class.forName(personName).newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return person;
    }
}
